package com.itheima.sh.user.service;

import com.itheima.sh.pojo.User;
import com.itheima.sh.user.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public User queryById(String username) {
        System.out.println("UserService..");
        if (username.equals("itheima")) {
            throw new RuntimeException("我出异常了..");
        }
//        try {
//            Thread.sleep(3000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return userMapper.findById(username);
    }
}
